package cn.fl.mcr.transform.white;


import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.vo.white.McrWhiteInspectVO;
import cn.lionbridgecapital.loan.model.dto.white.McrWhiteInspectDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 小贷白名单线上验证 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrWhiteInspectVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrWhiteInspectDTO
	 * @return McrWhiteInspectVO
	 */
	public static McrWhiteInspectVO baseToVO(McrWhiteInspectDTO dto) {
		McrWhiteInspectVO  vo = null;
		if (dto != null) { 
			vo = new McrWhiteInspectVO();
			vo.setId(dto.getId());
			vo.setUsrId(dto.getUsrId());//用户ID
			vo.setCstId(dto.getCstId());//客户ID
			vo.setCstNm(dto.getCstNm());//客户姓名
			vo.setCstMp(dto.getCstMp());//客户手机号
			vo.setCreditLvl(dto.getCreditLvl());//征信等级
			vo.setLoanCount(dto.getLoanCount());//放款次数
			vo.setSingleAmt(dto.getSingleAmt());//单笔限额
			vo.setDayAmt(dto.getDayAmt());//单日限额
			vo.setMothAmt(dto.getMothAmt());//本月最高限额
			vo.setBusType(dto.getBusType());//业务类型
			vo.setStartTm(dto.getStartTm());//开始时间
			vo.setEndTm(dto.getEndTm());//结束时间
			vo.setIsValid(dto.getIsValid());//是否有效
			vo.setIsDel(dto.getIsDel());//是否删除
			vo.setBusTypeDtl(dto.getBusTypeDtl());//业务子类型

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrWhiteInspectVO
	 * @return McrWhiteInspectDTO
	 */
	public static McrWhiteInspectDTO baseToDTO(McrWhiteInspectVO vo) {
		McrWhiteInspectDTO dto = null;
		if (vo != null) {
			dto = new McrWhiteInspectDTO();
			dto.setId(vo.getId());
			dto.setUsrId(vo.getUsrId());//用户ID
			dto.setCstId(vo.getCstId());//客户ID
			dto.setCstNm(vo.getCstNm());//客户姓名
			dto.setCstMp(vo.getCstMp());//客户手机号
			dto.setCreditLvl(vo.getCreditLvl());//征信等级
			dto.setLoanCount(vo.getLoanCount());//放款次数
			dto.setSingleAmt(vo.getSingleAmt());//单笔限额
			dto.setDayAmt(vo.getDayAmt());//单日限额
			dto.setMothAmt(vo.getMothAmt());//本月最高限额
			dto.setBusType(vo.getBusType());//业务类型
			dto.setStartTm(vo.getStartTm());//开始时间
			dto.setEndTm(vo.getEndTm());//结束时间
			dto.setIsValid(vo.getIsValid());//是否有效
			dto.setIsDel(vo.getIsDel());//是否删除
			dto.setBusTypeDtl(vo.getBusTypeDtl());//业务子类型

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}

	/**
	 * DTO 转  VO
	 * @param po McrWhiteInspectDTO
	 * @return McrWhiteInspectVO
	 */
	public static McrWhiteInspectVO toVO(McrWhiteInspectDTO dto) {
		McrWhiteInspectVO  vo = baseToVO(dto);
		//设置自定义扩展属性
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrWhiteInspectVO
	 * @return McrWhiteInspectDTO
	 */
	public static McrWhiteInspectDTO toDTO(McrWhiteInspectVO vo) {
		McrWhiteInspectDTO dto = baseToDTO(vo);
		//设置自定义扩展属性
		return dto;
	}

	/**
	 * DTO集合 转 VO集合
	 * @param List<McrWhiteInspectDTO>
	 * @return List<McrWhiteInspectVO>
	 */
	public static List<McrWhiteInspectVO> toVOList(List<McrWhiteInspectDTO> list) {
		List<McrWhiteInspectVO>  voList = new ArrayList<McrWhiteInspectVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWhiteInspectDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}

	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrWhiteInspectVO>
	 * @return List<McrWhiteInspectDTO>
	 */
	public static List<McrWhiteInspectDTO> toDTOList(List<McrWhiteInspectVO> list) {
		List<McrWhiteInspectDTO>  dtoList = new ArrayList<McrWhiteInspectDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrWhiteInspectVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
